-- 摆摊
require("TSLib")

local toucher = require("toucher")
local logger = require("logger")
local M = {}


function M.is_open(...)
	-- body
end


function main(...)
	init(1)
end

-- 切换TAB
function M.switch(idx, is_init)
	x, y = color.find_select_quests()
	mSleep(1000)
	if x == -1 and y == -1 then
		logger.info("click tabs(390.580).")
		toucher.click(390,580)
		mSleep(1000)
	end
	if is_init ~= nil and is_init then
		toucher.init_top(370,450)
	end
	for i = 1, idx, 1 do
		toucher.slide_down_tab(370,450)
	end
	mSleep(1000)
	-- 点击当前tab中的第一位
	toucher.click(400,380)
	mSleep(1000)
end

function M.get_gold(...)
	x, y = color.find_gold_1200();
	if x > 0 and y > 0 then
		return 1200, x, y;
	end
	x, y = color.find_gold_1350();
	if x > 0 and y > 0 then
		return 1350, x, y;
	end
	x, y = color.find_gold_1500();
	if x > 0 and y > 0 then
		return 1500, x, y;
	end
	x, y = color.find_gold_1650();
	if x > 0 and y > 0 then
		return 1650, x, y;
	end
	return 99999999,-1,-1;
end

return M